package com.pzl.controller;

import com.pzl.domain.User;
import com.pzl.service.UserService;
import com.sun.org.apache.xpath.internal.operations.Mod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * UserController class
 *
 * @Author panzhenglei
 * @Date 2019/6/13 2:40 PM
 */

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;



    @RequestMapping("/list.do")
    public ModelAndView findAll(){
        ModelAndView modelAndView = new ModelAndView();

        List<User> users = userService.findAll();
        System.out.println(users);


        modelAndView.addObject("userlist",users);

        modelAndView.setViewName("hellow");

        return modelAndView;
    }
}
